package com.beifu.manager.service.organizeservice.impl;

import com.beifu.manager.controller.LoginController;
import com.beifu.manager.dao.OrganizerMapper;
import com.beifu.manager.model.OrganizerExample;
import com.beifu.manager.service.organizeservice.OrganizeService;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: licy
 * @Date :  2018/6/17 17:51
 * @Last Modified by: licy
 * @Last Modified time:  2018/6/17 17:51
 */
@Service
public class OrganizeServiceImpl implements OrganizeService {

    private Logger logger = Logger.getLogger(LoginController.class);

    @Autowired
    private OrganizerMapper organizerMapper;

    @Override
    public int countOrganizeService(String organizeId) {
        OrganizerExample organizerExample = new OrganizerExample();
        if(StringUtils.isBlank(organizeId)){
            logger.error("没有传入机构号：organizeId："+organizeId);
            return 0;
        }
        int organizeIdint = Integer.valueOf(organizeId);
        organizerExample.createCriteria().andIdEqualTo(organizeIdint);
        return  organizerMapper.countByExample(organizerExample);
    }
}